package com.practice.线程池;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by IntelliJ IDEA2021.3
 * @Author: Tenghw
 * @Date: 2022/11/06  13:00
 * @Description: 5种线程池的创建
 */
@SuppressWarnings("all")
public class Demo2 {
    public static void main(String[] args) throws Exception{
        //ExecutorService pool1 = Executors.newCachedThreadPool();
        //ExecutorService pool2 = Executors.newCachedThreadPool(Executors.defaultThreadFactory());

        ExecutorService pool1 = Executors.newFixedThreadPool(4);
        ExecutorService pool2 = Executors.newFixedThreadPool(4, Executors.defaultThreadFactory());

        //ExecutorService pool1 = Executors.newSingleThreadExecutor();
        //ExecutorService pool2= Executors.newSingleThreadExecutor(Executors.defaultThreadFactory());

        //ExecutorService pool1 = Executors.newScheduledThreadPool(4);
        //ExecutorService pool2 = Executors.newScheduledThreadPool(4,Executors.defaultThreadFactory());

        //ExecutorService pool1 = Executors.newSingleThreadScheduledExecutor();
        //ExecutorService pool2 = Executors.newSingleThreadScheduledExecutor(Executors.defaultThreadFactory());
    }
}
